package cn.bblocks.common.i18n.demo;

import cn.bblocks.common.i18n.demo.config.SpringContextUtils;
import cn.bblocks.common.i18n.demo.util.I18nUtil;
import cn.bblocks.common.i18n.demo.util.MessageUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.MessageSource;

import java.util.Locale;

/**
 * bb-bb-i18n整合SpringBoot 示例
 * @author Jin
 *
 */
@Slf4j
@SpringBootApplication
public class I18nDemoApplication implements ApplicationRunner {

	public static void main(String[] args) {
		SpringApplication.run(I18nDemoApplication.class, args);
	}

	@Override
	public void run(ApplicationArguments args) throws Exception {
		log.info("项目启动成功》》》》》》I18nDemo");
		MessageSource messageSource = SpringContextUtils.getBean(MessageSource.class);


		System.out.println(I18nUtil.getMessage("A00001", null));
		System.out.println(I18nUtil.getMessage("A00001", Locale.CHINA.toLanguageTag()));
	}

}
